import request from '@/config/axios'

// 表单构建 VO
export interface instanceVO {
  // 主键id
  id: number
  // 表单名称
  formName: string
  // 表单编码
  formCode: string
  // 表单结构
  formSchema: string
}

// 表单构建 API
export const InstanceApi = {
  // 查询表单构建分页
  getInstanceData: async (params: any) => {
    return await request.get({ url: `/infra/form-construct/instance/schema`, params })
  },
  // 查询表单构建分页
  getListColumnDO: async (params: any) => {
    return await request.get({ url: `/infra/form-construct/instance/listColumnDO`, params })
  },
  getInstaceList: async (data: instanceVO) => {
    return await request.post({ url: `/infra/form-construct/instance/page`, data })
  },
  createInstance: async (data: instanceVO) => {
    return await request.post({ url: `/infra/form-construct/instance/create`, data })
  },
  updateInstance: async (data: instanceVO) => {
    return await request.put({ url: `/infra/form-construct/instance/update`, data })
  },
  instanceDetail: async (params: any) => {
    return await request.get({ url: `/infra/form-construct/instance/get`, params })
  },
  // 删除表单构建
  deleteInstance: async (id: number, formCode: string) => {
    return await request.delete({ url: `/infra/form-construct/instance/delete?id=${id}&formCode=${formCode}` })
  },
  // // 查询表单构建详情
  // getFormConstruct: async (id: number) => {
  //   return await request.get({ url: `/infra/form-construct/get?id=` + id })
  // },

  // // 新增表单构建
  // createFormConstruct: async (data: instanceVO) => {
  //   return await request.post({ url: `/infra/form-construct/create`, data })
  // },

  // // 修改表单构建
  // updateFormConstruct: async (data: instanceVO) => {
  //   return await request.put({ url: `/infra/form-construct/update`, data })
  // },

  // // 删除表单构建
  // deleteFormConstruct: async (id: number) => {
  //   return await request.delete({ url: `/infra/form-construct/delete?id=` + id })
  // },

  // // 导出表单构建 Excel
  // exportFormConstruct: async (params) => {
  //   return await request.download({ url: `/infra/form-construct/export-excel`, params })
  // },
  // // 新增表单构建
  // buildConstruct: async (data: instanceVO) => {
  //   return await request.post({ url: `/infra/form-construct/build`, data })
  // },

}
